home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
pcmagazi
/
1992
/
04
/
update.bas
< prev
next >
Wrap
BASIC Source File
|
1991-03-28
|
1KB
|
31 lines
'UPDATE.BAS - modifies a file's date and time stamp
DECLARE SUB UpDate (FileName$, InDate$, InTime$)
LINE INPUT " File to update: ", FileName$
LINE INPUT "Enter a new date: ", NewDate$
LINE INPUT "Enter a new time: ", NewTime$
CALL UpDate(FileName$, NewDate$, NewTime$)
SUB UpDate (FileName$, InDate$, InTime$) STATIC
DIM Temp AS STRING * 1 'this receives a byte from the file
FileNumber = FREEFILE 'create a unique file number
OPEN FileName$ FOR BINARY AS #FileNumber LEN = 1
GET #FileNumber, 1, Temp$ 'get a byte then put a byte
PUT #FileNumber, 1, Temp$ 'now the file appears to be changed
SaveDate$ = DATE$ 'save the current system date and time
SaveTime$ = TIME$
DATE$ = InDate$ 'set a new date and time
TIME$ = InTime$
CLOSE #FileNumber 'tell DOS to update the file's info
DATE$ = SaveDate$ 'restore the original date and time
TIME$ = SaveTime$
END SUB